const express = require("express");
const StockRouter = express.Router();
const StockServer = require("../../server/stockServer");
const sendMsg = require("../reqSendResult");
// 修改库存
StockRouter.put (
  "/updateStock",
  sendMsg.asyncHandler(async (req, res, next) => {
   await StockServer.updateStock(req.body);
  }, "修改库存成功")
);
// 获取库存列表
StockRouter.get(
  "/getStockList",
  sendMsg.asyncHandler(async (req, res) => {
    return await StockServer.getStockList(req.query.uid, req.query.page || 1, req.query.pageSize || 10);
  }, "获取库存列表成功")
);
// 获取库存详情
StockRouter.get(
  "/getStockDetail",
  sendMsg.asyncHandler(async (req, res) => {
    return await StockServer.getStockDetail(req.query);
  }, "获取库存详情成功")
);

module.exports = StockRouter;